<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.17"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>苞米面 C++ 模板库: 使用说明</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">苞米面 C++ 模板库
   </div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- 制作者 Doxygen 1.8.17 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'搜索');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',true,false,'search.php','搜索');
  $(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="PageDoc"><div class="header">
  <div class="headertitle">
<div class="title">使用说明 </div>  </div>
</div><!--header-->
<div class="contents">
<div class="textblock"><h1><a class="anchor" id="autotoc_md0"></a>
苞米面 C++ 模板库</h1>
<h2><a class="anchor" id="autotoc_md1"></a>
简介</h2>
<p>苞米面 C++ 模板库，无需编译，直接包含头文件就可以。 <br  />
 所有模板类和算法都包含在 <b>bmm</b> 名字空间里，例如： <b>bmm::recent**。 <br  />
 需要 C++ 编译器，支持 **C++17</b> 标准，只依赖 **C++ STL 标准模板库**。</p>
<h2><a class="anchor" id="autotoc_md2"></a>
依赖</h2>
<p><b>C++ STL 标准模板库</b></p>
<h2><a class="anchor" id="autotoc_md3"></a>
使用说明</h2>
<p>详细接口说明查看 <a href="doc/html"><b>doc/html</b></a> 里的文档。 <br  />
 说明书和示例查看 <a href="doc/manual"><b>doc/manual</b></a> 里的文档。 <br  />
</p>
<p><b>示例</b></p>
<div class="fragment"><div class="line"> {c++}</div>
<div class="line">#include &lt;iostream&gt;</div>
<div class="line">#include &lt;vector&gt;</div>
<div class="line">#include &quot;bmm/algo.hpp&quot;</div>
<div class="line"> </div>
<div class="line">int main(int argc, const char *argv[])</div>
<div class="line">{</div>
<div class="line">    std::cout &lt;&lt; &quot;algo example begin&quot; &lt;&lt; std::endl;</div>
<div class="line">    std::vector&lt;int&gt; vec = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10};</div>
<div class="line">    int n = 3;</div>
<div class="line">    if (bmm::is_in(vec, n))</div>
<div class="line">        std::cout &lt;&lt; &quot;is_in: &quot; &lt;&lt; n &lt;&lt; &quot; is in vec&quot; &lt;&lt; std::endl;</div>
<div class="line">    else</div>
<div class="line">        std::cout &lt;&lt; &quot;is_in: &quot; &lt;&lt; n &lt;&lt; &quot; is not in vec&quot; &lt;&lt; std::endl;</div>
<div class="line">    int k = 10;</div>
<div class="line">    int add = 50;</div>
<div class="line">    std::cout &lt;&lt; &quot;if_in before: &quot;;</div>
<div class="line">    for (auto i : vec)</div>
<div class="line">        std::cout &lt;&lt; i &lt;&lt; &quot; &quot;;</div>
<div class="line">    std::cout &lt;&lt; std::endl;</div>
<div class="line">    bmm::if_in(vec, k, [add](int &amp;i)</div>
<div class="line">               { i += add; });</div>
<div class="line">    std::cout &lt;&lt; &quot;if_in &quot; &lt;&lt; k &lt;&lt; &quot; += &quot; &lt;&lt; add &lt;&lt; &quot;: &quot;;</div>
<div class="line">    for (auto i : vec)</div>
<div class="line">        std::cout &lt;&lt; i &lt;&lt; &quot; &quot;;</div>
<div class="line">    std::cout &lt;&lt; std::endl;</div>
<div class="line">    std::cout &lt;&lt; &quot;algo example end&quot; &lt;&lt; std::endl;</div>
<div class="line">    return 0;</div>
<div class="line">}</div>
</div><!-- fragment --><p><b>结果</b></p>
<div class="fragment"><div class="line">algo example begin</div>
<div class="line">is_in: 3 is in vec</div>
<div class="line">if_in before: 1 2 3 4 5 6 7 8 9 10 </div>
<div class="line">if_in 10 += 50: 1 2 3 4 5 6 7 8 9 60 </div>
<div class="line">algo example end</div>
</div><!-- fragment --><h2><a class="anchor" id="autotoc_md4"></a>
功能说明</h2>
<p>所有模板类和算法都包含在 <b>bmm</b> 名字空间里，例如： <b>bmm::recent</b></p>
<h3><a class="anchor" id="autotoc_md5"></a>
容器</h3>
<table class="markdownTable">
<tr class="markdownTableHead">
<th class="markdownTableHeadNone">名称 </th><th class="markdownTableHeadNone">头文件 </th><th class="markdownTableHeadNone">说明书 </th><th class="markdownTableHeadNone">简介  </th></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone">recent </td><td class="markdownTableBodyNone"><a href="/bmm/recent.hpp">&lt;bmm/recent.hpp&gt;</a> </td><td class="markdownTableBodyNone">recent </td><td class="markdownTableBodyNone">最近使用的元素，类似于最近使用的文件  </td></tr>
</table>
<h3><a class="anchor" id="autotoc_md6"></a>
算法</h3>
<table class="markdownTable">
<tr class="markdownTableHead">
<th class="markdownTableHeadNone">名称 </th><th class="markdownTableHeadNone">头文件 </th><th class="markdownTableHeadNone">说明书 </th><th class="markdownTableHeadNone">简介  </th></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone">is_in </td><td class="markdownTableBodyNone"><a href="/bmm/algo.hpp">&lt;bmm/algo.hpp&gt;</a> </td><td class="markdownTableBodyNone">is_in </td><td class="markdownTableBodyNone">判断 value 是否在容器中  </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone">if_in </td><td class="markdownTableBodyNone"><a href="/bmm/algo.hpp">&lt;bmm/algo.hpp&gt;</a> </td><td class="markdownTableBodyNone">if_in </td><td class="markdownTableBodyNone">如果 value 在容器中则，调用函数 __func  </td></tr>
<tr class="markdownTableRowOdd">
<td class="markdownTableBodyNone">string_join </td><td class="markdownTableBodyNone"><a href="/bmm/string_algo.hpp">&lt;bmm/string_algo.hpp&gt;</a> </td><td class="markdownTableBodyNone">string_join </td><td class="markdownTableBodyNone">连接成一个字符串  </td></tr>
<tr class="markdownTableRowEven">
<td class="markdownTableBodyNone">string_split </td><td class="markdownTableBodyNone"><a href="/bmm/string_algo.hpp">&lt;bmm/string_algo.hpp&gt;</a> </td><td class="markdownTableBodyNone">string_split </td><td class="markdownTableBodyNone">分割字符串  </td></tr>
</table>
<h2><a class="anchor" id="autotoc_md7"></a>
开源协议</h2>
<p><a href="http://license.coscl.org.cn/MulanPSL2"><b>MulanPSL-2.0</b></a></p>
<h2><a class="anchor" id="autotoc_md8"></a>
项目地址</h2>
<p><b>GITEE</b>&#160;&#160;&#160;&#160;<b><a href="https://gitee.com/cnhemiya/bmm-cpp">https://gitee.com/cnhemiya/bmm-cpp</a></b> </p>
</div></div><!-- PageDoc -->
</div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
制作者 &#160;<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.17
</small></address>
</body>
</html>
